package com.mz.ozy.mvp.presenter;

import android.content.Context;

import com.mz.ozy.base.BasePresenterImpl;
import com.mz.ozy.mvp.model.ReportModel;
import com.mz.ozy.mvp.view.ReportContract;
import com.mz.ozy.net.MyObserver;
import com.mz.ozy.utils.RxUtil;

import org.json.JSONObject;

import okhttp3.ResponseBody;

/**
 * Created by administrator on 2018/12/3.
 */
public class ReportPresenter extends BasePresenterImpl<ReportContract.View> implements ReportContract.Presenter {

    private ReportModel mReportModel;

    public ReportPresenter() {
        mReportModel = new ReportModel();
    }

    @Override
    public void reportFriend(Context context, String uuid, String reasons){
        mReportModel.reportFriend(context,uuid,reasons)
                .compose(RxUtil.rxSchedulerHelper(mView.<ResponseBody>bindToLifecycle()))
                .subscribe(new MyObserver<JSONObject>(mView){

                    @Override
                    public void onSuccesss(JSONObject jsonObject) {
                        mView.reportSuccess(jsonObject);
                    }
                });
    }
}
